from flask import Flask#,render_template
from .views.auth import bp as login_bp
from .views.monitor import bp as monitor_bp
from .views.weatherforecast import bp as weather_bp
from .views.heatsourceinversion import bp as heatsourceinversion_bp
from .views.meteorogram import bp as meteorogram_bp
import config

def create_app():
    app=Flask(__name__)
    #Vue框架
    # app = Flask(__name__, static_folder='../SeaSystem-lin7/dist',
    #             template_folder="../SeaSystem-lin7/dist", static_url_path="")
    app.config.from_object(config)  # 绑定配置文件
    app.register_blueprint(login_bp)#增加前缀，不加前缀如果路由重名优先用第一个
    app.register_blueprint(monitor_bp)
    app.register_blueprint(weather_bp)
    app.register_blueprint(heatsourceinversion_bp)
    app.register_blueprint(meteorogram_bp)

    # @app.route('/ocean')
    # def index():
    #     return 'ocean'

    # @app.route('/ocean')
    # def index():
    #     return render_template('index.html')

    return app